<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:a4j="http://richfaces.org/a4j"
      xmlns:rich="http://richfaces.org/rich" >
    <h:head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <title>TODO supply a title</title>
        <script language="javascript">
            function showProj() {
                window.open("./pubinfo/projList.jsf", "项目列表", "height=1024,width=800,toolbar=no,menubar=no,scrollbars=no");
            }
            function updateProjSelect(code, name) {
                document.getElementById('emp_abroad:projcode').value = code;
                document.getElementById('emp_abroad:projname').value = name;
            }

            function showDept() {
                window.open("./pubinfo/departmentList.jsf", "部门列表", "height=1024,width=800,toolbar=no,menubar=no,scrollbars=no");
            }
            function updateDept(code, name) {
                document.getElementById('emp_abroad:deptcode').value = code;
                document.getElementById('emp_abroad:deptname').value = name;
            }
            function showCostItem() {
                window.open("./pubinfo/costItemList.jsf", "经济分类", "height=1024,width=800,toolbar=no,menubar=no,scrollbars=no");
            }
            function updateCostItemName(code, name) {
                document.getElementById('emp_abroad:costcode').value = code;
                document.getElementById('emp_abroad:costname').value = name;
            }
        </script>
        <style type="text/css">
            .inputstype{
                width: 100px !important;
            }
        </style>
    </h:head>
    <h:body>
        <h:form id="emp_abroad">
            <rich:panel header="出国差旅费支付列表" styleClass="content-hight">               
                <rich:collapsiblePanel header="查询条件" switchType="client" expanded="false">
                    <h:panelGrid columns="4" >
                        <h:outputLabel value="单据编号：" for="number" />
                        <h:inputText size="17" id="number" value="#{abroadGroupCheckBean.qta.number}" />
                        <h:outputText value="单据日期："/>
                        <h:panelGroup>
                            <rich:calendar value="#{abroadGroupCheckBean.qta.numDateStart}"
                                           locale="zh_CN"
                                           popup="true"
                                           datePattern="yyyy-MM-dd"
                                           showApplyButton="false"  inputClass="inputstype"/>
                            至
                            <rich:calendar value="#{abroadGroupCheckBean.qta.numDateEnd}"
                                           locale="zh_CN"
                                           popup="true"
                                           datePattern="yyyy-MM-dd"
                                           showApplyButton="false"  inputClass="inputstype"/>
                        </h:panelGroup>
                        <h:outputLabel value="单据状态："/>
                        <h:selectOneMenu value="#{abroadGroupCheckBean.status}" style=" width: 125px;">
                            <f:selectItem itemValue=" " itemLabel="---请 选 择---"/>
                            <f:selectItems value="#{abroadGroupCheckBean.payStatusList}"/>
                        </h:selectOneMenu>
                        <h:outputLabel value="出差事由：" for="affair" />
                        <h:inputText size="17" id="affair" value="#{abroadGroupCheckBean.qta.affair}" />
                        <h:outputLabel value="报销金额：" />
                        <h:panelGroup>
                            <h:inputText size="17" id="totalStart" value="#{abroadGroupCheckBean.qta.totalStart}"/>
                            - <h:inputText size="17" id="totalEnd" value="#{abroadGroupCheckBean.qta.totalEnd}"/>
                        </h:panelGroup>
                        <h:outputLabel value="预算项目：" for="projname" />
                        <h:inputText size="17" id="projname" value="#{abroadGroupCheckBean.qta.project.finName}"
                                     onclick="#{rich:component('projPanel')}.show();"/>
                        <h:outputLabel value="报销人：" for="cpsn_name" />
                        <h:inputText size="17" id="cpsn_name" value="#{abroadGroupCheckBean.qta.user.cpsn_number}" />
                        <h:outputLabel value="部门：" for="deptname" />
                        <h:inputText size="17" id="deptname" value="#{abroadGroupCheckBean.qta.dept.name}"
                                     onclick="#{rich:component('deptPanel')}.show();"/>
                        <h:outputLabel value="支出类别：" for="costClass"/>
                        <h:selectOneMenu id="costClass" value="#{abroadGroupCheckBean.qta.costClass}"
                                         style=" width: 125px;">
                            <f:selectItem itemValue=" " itemLabel="---请 选 择---"/>
                            <f:selectItem itemValue="0" itemLabel="基本支出"/>
                            <f:selectItem itemValue="1" itemLabel="项目支出"/>
                        </h:selectOneMenu>
                        <h:outputLabel value="预算来源：" for="budgetSource" />
                        <h:inputText size="17" id="budgetSource" value="#{abroadGroupCheckBean.qta.budgetSource}" />
                        <h:outputLabel value="经济分类：" for="costname" />
                        <h:inputText size="17" id="costname" value="#{abroadGroupCheckBean.qta.costitem.name}"
                                     onclick="showCostItem();"/>
                        <h:outputLabel value="支出渠道：" for="costType" />
                        <h:selectOneMenu  id="costType" value="#{abroadGroupCheckBean.qta.costTypes.code}"
                                          style=" width: 125px;">
                            <f:selectItem itemValue=" " itemLabel="---请 选 择---"/>
                            <f:selectItems value="#{class.selectItemList}" />
                        </h:selectOneMenu>
                        <h:outputLabel value="支付令：" for="paycode" />
                        <h:inputText size="17" id="paycode" value="#{abroadGroupCheckBean.qta.paycode}" />
                        <h:outputLabel value="核定金额：" />
                        <h:panelGroup>
                            <h:inputText size="17" id="checkaccountStart" value="#{abroadGroupCheckBean.qta.checkaccountStart}"/>
                            - <h:inputText size="17" id="checkaccountEnd" value="#{abroadGroupCheckBean.qta.checkaccountEnd}"/>
                        </h:panelGroup>
                        <h:outputText value="审核日期："/>
                        <h:panelGroup>
                            <rich:calendar value="#{abroadGroupCheckBean.qta.auditDateStart}"
                                           locale="zh_CN"
                                           popup="true"
                                           datePattern="yyyy-MM-dd"
                                           showApplyButton="false"  inputClass="inputstype"/>
                            至
                            <rich:calendar value="#{abroadGroupCheckBean.qta.auditDateEnd}"
                                           locale="zh_CN"
                                           popup="true"
                                           datePattern="yyyy-MM-dd"
                                           showApplyButton="false"  inputClass="inputstype"/>
                        </h:panelGroup>
                        <h:outputLabel value="支付金额：" />
                        <h:panelGroup>
                            <h:inputText size="17" id="payaccountStart" value="#{abroadGroupCheckBean.qta.payaccountStart}"/>
                            - <h:inputText size="17" id="payaccountEnd" value="#{abroadGroupCheckBean.qta.payaccountEnd}"/>
                        </h:panelGroup>
                        <h:outputText value="支付日期："/>
                        <h:panelGroup>
                            <rich:calendar value="#{abroadGroupCheckBean.qta.payDateStart}"
                                           locale="zh_CN"
                                           popup="true"
                                           datePattern="yyyy-MM-dd"
                                           showApplyButton="false"  inputClass="inputstype"/>
                            至
                            <rich:calendar value="#{abroadGroupCheckBean.qta.payDateEnd}"
                                           locale="zh_CN"
                                           popup="true"
                                           datePattern="yyyy-MM-dd"
                                           showApplyButton="false"  inputClass="inputstype"/>
                        </h:panelGroup>                          
                        <h:inputHidden id="costcode" value="#{abroadGroupCheckBean.qta.costitem.code}"/>
                    </h:panelGrid>
                </rich:collapsiblePanel>                  

                <h:commandButton value="查询" action="#{abroadGroupCheckBean.queryAbroadList}"/>
                <h:commandButton value="取消" action="#{abroadGroupCheckBean.cancel}"/>
                <h:commandButton value="导出Excel" action="#{abroadGroupCheckBean.exportExcel}"
                                 disabled="#{abroadGroupCheckBean.abroadModel.rowCount le 0}" />

                <div style="width:100%;overflow:auto">
                    <rich:dataTable value="#{abroadGroupCheckBean.abroadModel}" var="tralist" rows="10"
                                    style=" width: 1800px;" id="tplist">
                        <rich:column sortBy="#{tralist.number}">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="单据编号"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:commandLink action="#{abroadGroupCheckBean.showAbroadDetailforPay}">
                                <h:outputText value="#{tralist.number}"/>
                            </h:commandLink>
                        </rich:column>
                        <rich:column sortBy="#{tralist.numDate}">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="单据日期"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{tralist.numDate}">
                                <f:convertDateTime pattern="yyyy年MM月dd日" timeZone="GMT+8" locale="cn" />
                            </h:outputText>
                        </rich:column>
                        <rich:column sortBy="#{tralist.numberStatus}">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="单据状态"/>
                                </h:panelGroup>
                            </f:facet>                 
                            <h:outputText value="等待审核"  rendered="#{tralist.numberStatus == '0'}" style="color:blue"/>
                            <h:outputText value="退回修改"  rendered="#{tralist.numberStatus == '3'}" style="color:red"/>
                            <h:outputText value="等待支付"  rendered="#{tralist.numberStatus == '2'}" style="color:green"/>
                            <h:outputText value="确认支付"  rendered="#{tralist.numberStatus == '4'}" style="color:blue"/>
                            <h:outputText value="支付完毕"  rendered="#{tralist.numberStatus == '6'}" style="color:blue"/>
                        </rich:column>

                        <rich:column sortBy="#{tralist.payDept.name}">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="部门"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{tralist.payDept.name}"/>
                        </rich:column>
                        <rich:column sortBy="#{tralist.feePer.cpsn_name}">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="报销人"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{tralist.feePer.cpsn_name}"/>
                        </rich:column>
                        <rich:column sortBy="#{tralist.project.finName}">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="预算项目"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{tralist.project.finName}"/>
                        </rich:column>


                        <rich:column sortBy="#{tralist.affair}">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="出差事由"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{tralist.affair}"/>
                        </rich:column>

                        <rich:column sortBy="#{tralist.total}">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="报销金额"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{tralist.total}">
                                <f:convertNumber type="number" pattern="#,##0.00"/>
                            </h:outputText>
                        </rich:column>           

                        <rich:column sortBy="#{tralist.costClass}">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="支出类别"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="基本支出" rendered="#{tralist.costClass == '0'}"/>
                            <h:outputText value="项目支出" rendered="#{tralist.costClass == '1'}"/>
                        </rich:column>

                        <rich:column sortBy="#{tralist.budgetSource}">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="预算来源"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{tralist.budgetSource}"/>
                        </rich:column>

                        <rich:column sortBy="#{tralist.costitem.name}">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="经济分类"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{tralist.costitem.name}"/>
                        </rich:column>
                        <rich:column sortBy="#{tralist.costTypes.name}">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="支出渠道"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{tralist.costTypes.name}"/>
                        </rich:column>

                        <rich:column sortBy="#{tralist.paycode}">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="支付令"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{tralist.paycode}" style="width:350px" />
                        </rich:column>

                        <rich:column sortBy="#{tralist.checkaccount}">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="核定金额"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{tralist.checkaccount}">
                                <f:convertNumber type="number" pattern="#,##0.00"/>
                            </h:outputText>
                        </rich:column>

                        <rich:column sortBy="#{tralist.auditDate}">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="审核日期"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{tralist.auditDate}">
                                <f:convertDateTime pattern="yyyy年MM月dd日" timeZone="GMT+8" locale="cn" />
                            </h:outputText>
                        </rich:column>

                        <rich:column sortBy="#{tralist.auditor}">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="审核人"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{tralist.auditor}"/>
                        </rich:column>

                        <rich:column sortBy="#{tralist.payaccount}">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="支付金额"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{tralist.payaccount}">
                                <f:convertNumber type="number" pattern="#,##0.00"/>
                            </h:outputText>
                        </rich:column>

                        <rich:column sortBy="#{tralist.payDate}">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="支付日期"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{tralist.payDate}">
                                <f:convertDateTime pattern="yyyy年MM月dd日" timeZone="GMT+8" locale="cn" />
                            </h:outputText>
                        </rich:column>

                        <rich:column sortBy="#{tralist.payer}">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="出纳"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{tralist.payer}"/>
                        </rich:column>

                        <f:facet name="footer">
                            <rich:dataScroller id="ds"></rich:dataScroller>
                        </f:facet>
                    </rich:dataTable>
                </div>

            </rich:panel>
        </h:form>
        <rich:popupPanel id="projPanel" autosized="true">
            <f:facet name="header">项目信息</f:facet>
            <f:facet name="controls">
                <h:outputLink value="#" onclick="#{rich:component('projPanel')}.hide();">关闭</h:outputLink>
            </f:facet>
            <h:form id="projList">
                <rich:dataTable id="editTable" value="#{abroadGroupCheckBean.finProjModel}" rows="10"  var="pro"
                                onrowmouseover="this.style.backgroundColor='#F1F1F1'"
                                onrowmouseout="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'"
                                rowClasses="list-row-odd,list-row-even">
                    <rich:column>
                        <f:facet name="header">
                            <h:panelGroup>
                                <h:outputText value="预算项目编码"/>
                            </h:panelGroup>
                        </f:facet>
                        <a4j:commandLink id="Projlinks" action="#{abroadGroupCheckBean.selectProjForQuery}"
                                         onclick="#{rich:component('projPanel')}.hide();"
                                         render="projname" >
                            <h:outputText value="#{pro.finCode}"/>
                        </a4j:commandLink>
                    </rich:column>

                    <rich:column>
                        <f:facet name="header">
                            <h:panelGroup>
                                <h:outputText value="预算项目名称"/>
                            </h:panelGroup>
                        </f:facet>
                        <h:outputText value="#{pro.finName}"/>
                    </rich:column>
                    <rich:column>
                        <f:facet name="header">
                            <h:panelGroup>
                                <h:outputText value="备注"/>
                            </h:panelGroup>
                        </f:facet>
                        <h:outputText value="#{pro.memo}"/>
                    </rich:column>

                    <f:facet name="footer">
                        <rich:dataScroller id="ds"></rich:dataScroller>
                    </f:facet>
                </rich:dataTable>
            </h:form>
        </rich:popupPanel>
        <rich:popupPanel id="deptPanel" autosized="true">
            <f:facet name="header">
                <h:panelGroup>
                    <h:outputText value="费用承担部门"></h:outputText>
                </h:panelGroup>
            </f:facet>
            <f:facet name="controls">
                <h:outputLink value="#" onclick="#{rich:component('deptPanel')}.hide();">关闭</h:outputLink>
            </f:facet>
            <h:form>
                <rich:panel>
                    <h:panelGrid columns="2" width="100%" border="0" id="mainform">
                        <rich:tree value="#{departmentBean.rootNode}" var="idept"
                                   selectionType="ajax" toggleType="client"
                                   selectionChangeListener="#{abroadGroupCheckBean.selecteDeptForQuery}"
                                   style="width:300px" render="deptname">
                            <rich:treeNode>
                                <h:outputText value="[#{idept.data.code}]#{idept.data.name}" />
                                <rich:componentControl target="deptPanel" operation="hide" event="click"/>
                            </rich:treeNode>
                        </rich:tree>
                    </h:panelGrid>
                </rich:panel>
            </h:form>

            <f:facet name="footer">
                footer!
            </f:facet>

        </rich:popupPanel>
    </h:body>
</html>

